//根据输入的日期，计算是这一年的第几天。输入保证年份为4位数且日期合法。
//输入描述：输入一行，每行空格分割，分别是年，月，日。
//输出描述：输出是这一年的第几天
//注意闰年考虑
//	1	  2	    3    4	 5	 6	 7	 8	 9	  10	11	 12
//  31  29/28	31  30  31   30  31  31  30   31    30   31
//  1    -1/-2  +1   0   +1  0   +1  +1   0   +1     0    +1 
#pragma warning(disable:4996)
#include<stdio.h>
int Find_Leap_Year(int year)
{
	if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
		return 1;
	return 0;
}
int main()
{
	int year, month, day;
	scanf("%d %d %d", &year, &month, &day);
	
	switch (month) 
	{
	case 1:
		day = day;
		break;
	case 2:
		day += 31;
		break;
	case 3:
		day += 59;
		break;
	case 4:
		day += 90;
		break;
	case 5:
		day += 120;
		break;
	case 6:
		day += 151;
		break;
	case 7:
		day += 181;
		break;
	case 8:
		day += 212;
		break;
	case 9:
		day += 243;
		break;
	case 10:
		day += 273;
		break;
	case 11:
		day += 304;
		break;
	case 12:
		day += 334;
		break;
	default:		
		break;
	}
	
	if (Find_Leap_Year(year) && month >= 3) {
		day += 1;
	}
	printf("%d", day);
		return 0;
}
